﻿using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IService
{
    public interface IBiWarehouseService
    {
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="data">实体</param>
        /// <returns>结果</returns>
        Task<int> CreateAsync(BiWarehouse data);

        /// <summary>
        /// 根据ID查询
        /// </summary>
        /// <param name="Id">ID</param>
        /// <returns>用户列表</returns>
        Task<BiWarehouse> GetByIdAsync(int Id);

        /// <summary>
        /// 查询所有
        /// </summary>
        /// <returns>用户列表</returns>
        Task<List<BiWarehouse>> GetAllAsync();

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="date">包含更新信息</param>
        Task<int> UpdateAsync(BiWarehouse date);

        /// <summary>
        /// 根据ID删除
        /// </summary>
        /// <param name="Id">ID</param>
        Task<int> DeleteAsync(int Id);

        /// <summary>
        /// 库位与仓库主管（用户表）两表联查
        /// 等价于SQL：SELECT storage_location_name,users_name FROM dbo.wh_location INNER JOIN dbo.sys_users ON StorageLocationId= sys_users.users_id
        /// </summary>
        /// <returns>包含库位名称和主管用户名的列表</returns>
        public Task<List<dynamic>> GetLocationWithUserAsync();


        /// <summary>
        /// 查询所有主管,
        /// </summary>
        /// <returns></returns>
        public Task<List<dynamic>> GetUniqueLocationManagersAsync();


        /// <summary>
        /// 新增库位
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public Task<int> LocationAddAsync(WhLocation data);


        /// <summary>
        /// 事务处理：同时保存仓库和库位信息
        /// </summary>
        Task<int> SaveWithTransactionAsync(BiWarehouse warehouse, List<WhLocation> locations);
        public Task<List<UsersDTO>> GetWarehouseManagersAsync(long warehouseManageOrgId);
    }
}
